import {Component} from '@angular/core';
import {NavController, NavParams} from 'ionic-angular';

import {Backend} from '../../providers/backend';
import {Login} from './tab-my-login';
@Component({
  templateUrl: 'build/pages/tab-my/tab-my-forget.html'
})
export class Forget {

  static get parameters() {
    return [[NavController], [NavParams], [Backend]];
  }

  constructor(nav, params, backend) {
    this.nav = nav;
    this.params = params;
    this.backend = backend;
    this.email;
    this.menus = {};
    this.wrongmessage = '';
  }
  login() {
    this.backend.forgetpasw(this.email)
      .then(result => {
        if (result == 'Invalid user') {
          this.wrongmessage = result;
        } else {
          this.wrongmessage = result.info;
          console.log(this.wrongmessage);
          if (this.wrongmessage == 'ok') {
            this.nav.pop();
          }
        }

      });

  }
}
